import React, { Component } from 'react'
import classnames from 'classnames'
export default class Tabs extends Component {
  // 子传父
  changeTab = (type) => {
    this.props.changeTab(type)
  }
  render() {
    return (
      <div className="tabs-order">
        <ul className="sort-container">
          {this.props.tabs.map((item) => (
            <li
              // className={state.active === item.type ? 'on' : ''}
              className={classnames({
                on: item.type === this.props.active,
              })}
              key={item.id}
              onClick={() => this.changeTab(item.type)}
            >
              按{item.name}排序
            </li>
          ))}
          {/* <li>按时间排序</li> */}
        </ul>
      </div>
    )
  }
}
